import List from "antd/es/list";
import moment from "moment";
import Link from "next/link";
import React from "react";

export interface CommentPreviewProps {
  comment: API.CommentWithArticleDto;
}
const CommentPreview: React.FC<CommentPreviewProps> = ({ comment }) => {
  return (
    <List.Item
      className="cursor-pointer hover:bg-gray-100 transition-colors rounded-lg"
      key={comment.id}
    >
      <List.Item.Meta
        title={
          <Link
            target="_blank"
            href={`/customer/community/detail/${comment.article.id}`}
          >
            文章来源：{comment.article.title}
          </Link>
        }
        description={`评论时间: ${moment(comment.createdAt).format(
          "YYYY-MM-DD HH:mm:ss"
        )}`}
      />
      <div>{comment.content}</div>
    </List.Item>
  );
};
export default CommentPreview;
